using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using WebCrawlerTools.page;

namespace WebCrawlerTools.data
{
    [Serializable]
    public class DBasicInfo
    {
        public static DBasicInfo Load()
        {
            DBasicInfo datainfo = new DBasicInfo();
            try
            {
                using (System.IO.StreamReader reader = new System.IO.StreamReader("BasicInfo.xml"))
                {
                    System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(DBasicInfo));
                    datainfo = (DBasicInfo)xs.Deserialize(reader);
                    reader.Close();
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }
            return datainfo;
        }

        public static void Store(DBasicInfo datainfo)
        {
            using (System.IO.StreamWriter writer = new System.IO.StreamWriter("BasicInfo.xml"))
            {
                System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(DBasicInfo));
                xs.Serialize(writer, datainfo);
                writer.Close();
            }
        }

        private ArrayList pHomePages = new ArrayList();

        public ArrayList PHomePages
        {
            get { return pHomePages; }
            set { pHomePages = value; }
        }

        private PHomePage page;

        public WebCrawlerTools.page.PHomePage Page
        {
            get
            {
                return page;
            }
            set
            {
                page = value;
            }
        }

        private string dataPath;

        public string DataPath
        {
            get
            {
                return dataPath;
            }
            set
            {
                dataPath = value;
            }
        }
    }
}
